﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MODEL;
using OperationHandlers;

namespace FE
{
    public partial class ProductMangament : Form
    {
        ProductOperations _productOperations = new ProductOperations();
        public ProductMangament()
        {
            InitializeComponent();
        }

        private void OkBtn_Click(object sender, EventArgs e)
        {
            Product p = new Product();
            p.name = NameTxt.Text;
            p.price = decimal.Parse(PriceTxt.Text);
            p.VATID = int.Parse(BTWcombo.SelectedItem.ToString());
            bool _productAdded = _productOperations.ProductAdd(p);

            if (_productAdded == true)
            {
                MessageBox.Show("Product Added");
            }
            else if(_productAdded == false)
            {
                MessageBox.Show("Error in Making product");
            }
        }

        private void ClearBtn_Click(object sender, EventArgs e)
        {
            NameTxt.Clear();
            PriceTxt.Clear();
        }

    }
}
